![]() |
PATH![]() |
With the following functions you can find an applet through an HTML page, instantiate it within an AWT context, and set or receive information associated with it.
Locates an applet synchronously using information in the applet locator information block structure.
OSStatus JMNewAppletLocatorFromInfo (
JMAppletLocatorRef* locatorRef,
JMSessionRef session,
const JMLocatorInfoBlock* info,
JMClientData data);
The
JMNewAppletLocator
function.
The
JMDisposeAppletLocator
function.
Locates an applet asynchronously by fetching an HTML document from a specified URL.
OSStatus JMNewAppletLocator (
JMAppletLocatorRef* locatorRef,
JMSessionRef session,
const JMAppletLocatorCallbacks* callbacks,
const JMTextRef url,
const JMTextRef htmlText,
JMClientData data);
If you have already retrieved the HTML document, you can pass it to JMNewAppletLocator in the htmlText argument. Otherwise, JMNewAppletLocator starts a separate thread to retrieve the document. The client application must call JIdle to allow the new thread time to retrieve the document. The callback that executes upon fetching the HTML document can occur either while this function is executing or some time after it has returned.
The
JMNewAppletLocatorFromInfo
function.
The
JMDisposeAppletLocator
function.
OSStatus JMDisposeAppletLocator (JMAppletLocatorRef locatorRef);
Since the applet locator merely locates an applet, you can dispose of it after instantiating the applet. You can call
JMDisposeAppletLocator
while the thread created by
JMNewAppletLocator
function
JMNewAppletLocator
is still searching for the applet.
The
JMNewAppletLocatorFromInfo
function.
Retrieves client data associated with an applet locator.
OSStatus JMGetAppletLocatorData (
JMAppletLocatorRef locatorRef,
JMClientData* data);
JMSetAppletLocatorData
function.Assigns client data to an applet locator.
OSStatus JMSetAppletLocatorData (
JMAppletLocatorRef locatorRef,
JMClientData data);
JMGetAppletLocatorData
function.Counts the number of applets associated with an HTML page.
OSStatus JMCountApplets (
JMAppletLocatorRef locatorRef,
UInt32* appletCount);
If there are no applets associated with the text,
JMCountApplets
returns 0. You can call this function only after successfully retrieving HTML text using The
JMNewAppletLocator
function.
Returns the dimensions of an applet.
OSStatus JMGetAppletDimensions (
JMAppletLocatorRef locatorRef,
UInt32 appletIndex,
UInt32* width,
UInt32* height);
The
appletIndex
value is an index number from 0 to
appletCount
-1, where
appletCount
is determined by the
JMCountApplets
function
JMCountApplets
. You can call this function only after successfully retrieving HTML text using The
JMNewAppletLocator
function.
Returns the tag associated with an applet.
OSStatus JMGetAppletTag (
JMAppletLocatorRef locatorRef,
UInt32 appletIndex,
JMTextRef* tagRef);
The
JMGetAppletTag
function returns the text bounded by the
<APPLET>
and
</APPLET>
delimeters in an HTML document. The
appletIndex
value is an index number from 0 to
appletCount
-1, where
appletCount
is determined by the
JMCountApplets
function
JMCountApplets
. You can call this function only after successfully retrieving HTML text using The
JMNewAppletLocator
function.
Returns the name of an applet.
OSStatus JMGetAppletName (
JMAppletLocatorRef locatorRef,
UInt32 appletIndex,
JMTextRef* nameRef);
The
appletIndex
value is an index number from 0 to
appletCount
-1, where
appletCount
is determined by the
JMCountApplets
function
JMCountApplets
. You must reserve a buffer for the text object containing the applet name and pass a pointer to the buffer when you call
JMGetAppletName
. You can call this function only after successfully retrieving HTML text using The
JMNewAppletLocator
function.
OSStatus JMNewAppletViewer (
JMAppletViewerRef* viewer,
JMAWTContextRef context,
JMAppletLocatorRef locatorRef,
UInt32 appletIndex,
const JMAppletSecurity* security
const JMAppletViewerCallbacks* callbacks,
JMClientData data);
To instantiate an applet, you must first create an AWT context (and start the thread associated with it) and create an applet locator. The appletIndex value is an index number from 0 to appletCount -1, where appletCount is determined by the JMCountApplets function.
The
JMCountApplets
function.
The
JMDisposeAppletViewer
function.
OSStatus JMDisposeAppletViewer (JMAppletViewerRef viewer);
Calling the JMDisposeAppletLocator function first halts execution of the applet if necessary. This function also disposes of the applet's frame (if visible) and any other frames created by the applet.
The
JMNewAppletViewer
function.
Retrieves client data associated with an applet.
OSStatus JMGetAppletViewerData (
JMAppletViewerRef viewer,
JMClientData* data);
JMSetAppletViewerData
function.
Assigns client data to an applet.
OSStatus JMSetAppletViewerData (
JMAppletViewerRef viewer,
JMClientData data);
JMGetAppletViewerData
function.Gets the security options for an applet.
extern OSStatus JMGetAppletViewerSecurity (
JMAppletViewerRef viewer,
JMAppletSecurity* data);
JMSetAppletViewerSecurity
function.JMNewAppletViewer
function.Sets the security options for an applet.
OSStatus JMSetAppletViewerSecurity (
JMAppletViewerRef viewer,
const JMAppletSecurity* data);
JMGetAppletViewerSecurity
function.Loads (or reloads) an applet from its source server and executes it.
OSStatus JMReloadApplet (JMAppletViewerRef viewer);
You can also use this function to reload and restart the applet at any time (if the code has changed, for example). If you want to restart the applet without reloading the applet code, you should use The
JMRestartApplet
function.
Restarts an applet without reloading it from the source server.
OSStatus JMRestartApplet (JMAppletViewerRef viewer);
This function corresponds to the Java method
java.applet.Applet.start
. If you want to reload the applet code before execution, you should use the
JMReloadApplet
function.
Suspends execution of an applet and any associated threads.
OSStatus JMSuspendApplet (JMAppletViewerRef viewer);
The
JMResumeApplet
function.
Resumes execution of a suspended applet.
OSStatus JMResumeApplet (JMAppletViewerRef viewer);
You can use the
JMResumeApplet
function to resume execution of an applet halted by the
JMSuspendApplet
function
JMSuspendApplet
. If you want to restart the applet from the beginning, you should use the
JMRestartApplet
function
JMRestartApplet
or the
JMReloadApplet
function
JMReloadApplet
.
Finds the applet that owns a particular frame.
OSStatus JMGetFrameViewer (
JMFrameRef frame,
JMAppletViewerRef* viewer,
JMFrameRef* parentFrame);
The
JMCountAWTContextFrames
function.
Finds the parent frame for a given applet.
OSStatus JMGetViewerFrame (
JMAppletViewerRef viewer,
JMFrameRef* frame);
The
JMCountAWTContextFrames
function.
Returns a JNI reference to a JMAppletViewerRef object.
jobject JMGetAppletViewerJNIObject (
JMAppletViewerRef viewer,
JNIEnv * env);
The JMAppletViewerRef object is not the same as an applet object (that is, a java. applet.Applet object). A JMAppletViewer object encapsulates the Java applet object so it may be handled outside the Java environment.
Returns a JRI reference to a JMAppletViewerRef object.
jref JMGetAppletViewerObject (JMAppletViewerRef viewer);
The JMAppletViewerRef object is not the same as an applet object (that is, a java. applet.Applet object). A JMAppletViewer object encapsulates the Java applet object so it may be handled outside the Java environment.
Note that unless you specifically need to use the Java Runtime Interface (JRI), you should use the
JMGetAppletViewerJNIObject
function instead.
Returns a JNI reference to the Java applet object.
jobject JMGetAppletJNIObject (
JMAppletViewerRef viewer,
JNIEnv * env);
This function returns a reference to the actual applet object rather than to the JMAppletViewerRef object handled by the embedding application.
Returns a JRI reference to the Java applet object.
jref JMGetAppletObject (JMAppletViewerRef viewer);
This function returns a reference to the actual applet object rather than to the JMAppletViewerRef object handled by the embedding application.
Note that unless you specifically need to use the Java Runtime Interface (JRI), you should use the function instead.